/**
 * 
 */
package edu.hadassah.store.management;

import edu.hadassah.store.order.IOrder;
import edu.hadassah.store.order.IOrderInfo;
import edu.hadassah.store.order.OrderInfoImpl;
import edu.hadassah.store.uniqueid.IUniqueId;

/**
 * @author persikov
 *
 */
public final class Order extends OrderInfoImpl implements IOrder{

	private final IUniqueId id;
	/**
	 * Copy Constructor
	 *
	 * @param orderInfo a <code>Order</code> object
	 */
	Order(IUniqueId id, IOrderInfo orderInfo) 
	{
		super(orderInfo);
		this.id = id;
	}

	/**
	 *
	 * @param order a <code>Order</code> object
	 */
	void updateOrderInfo(IOrderInfo order) 
	{
	    this.itemQuantity = order.getItemsQuantity();
	    this.itemName = order.getItemName();
	}

	/**
	 * @param clientId
	 */
	Order(IUniqueId id, IUniqueId clientId) {
		super(clientId, "", 0);
		this.id = id;
	}

	/**
	 * @return
	 * @see edu.hadassah.store.order.IOrder#getId()
	 */
	public IUniqueId getId() {
		return id;
	}

	public IOrderInfo toMemento(){
		return new OrderInfoImpl(this);
	}
	/**
	 * Constructs a <code>String</code> with all attributes in name = value format.
	 *
	 * @return a <code>String</code> representation of this object.
	 */
	@Override
	public String toString()
	{
	    final String TAB = "    ";
	    
	    String retValue = "";
	    
	    retValue = "Order ( "
	    	+ "id = " + this.id + TAB
	        + super.toString() + TAB
	        + " )";
	
	    return retValue;
	}



}
